<template>
  <div>
    <button @click="isShow = !isShow">隐藏/显示</button>
    <transition>
      <h1 v-if="isShow">你好1</h1>
    </transition>
    <transition name="two">
      <h1 v-if="isShow">你好2</h1>
    </transition>
  </div>
</template>

<script>
  export default {
    name:'App',
    data() {
      return {
        isShow:true
      }
    },
  }
</script>

<style>
  h1 {
    background-image: linear-gradient(45deg,red,yellow,green);
    box-shadow: 0 0 5px;
  }
  @keyframes dongqilai {
    from{
      transform: translateX(0);
    }
    to{
      transform: translateX(-100%);
    }
  }
  .v-leave-active {
    animation: dongqilai 3s linear;
  }
  .v-enter-active {
    animation: dongqilai 3s linear reverse;
  }
  .two-leave-active {
    animation: dongqilai 0.5s linear;
  }
  .two-enter-active {
    animation: dongqilai 0.5s linear reverse;
  }
</style>